DECLARE
birth_date DATE;
curr_date DATE;
age_interval INTERVAL YEAR TO MONTH;
years_of_Age NUMBER;
months_of_Months NUMBER;
BEGIN
--Enter the date in the MM-DD-YYYY format only.
birth_date := TO_DATE('&birth_date', 'MM-DD-YYYY');
curr_date := sysdate;
age_interval := (curr_date - birth_date) YEAR TO MONTH;
DBMS_OUTPUT.PUT_LINE(age_interval);
years_of_Age := EXTRACT(YEAR FROM age_interval);
months_of_Months := EXTRACT(MONTH FROM age_interval);
DBMS_OUTPUT.PUT_LINE('Your Date of Birth: ' || birth_date);
DBMS_OUTPUT.PUT_LINE('Age: ' || years_of_Age || ' years and '||
months_of_Months || ' months');
END;
/